import { Skin1CellRenderer } from "../common/item/Skin1CellRenderer";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { SCrossBossGuildInfo } from "../../../../Message/Public/SCrossBossGuildInfo";
import { ListData } from "../../../../fl/controls/listClasses/ListData";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { EntityUtil } from "../../scene/layer/utils/EntityUtil";
import { GameDefConfig } from "../../resource/GameDefConfig";
import { ColorConfig } from "../../resource/ColorConfig";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
//class CrossBossRanking
    
    export  class CrossBossRanking extends Skin1CellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ initStyle(): void
        {
            super.initStyle();
            var loc1=this.getStyle("selectedDownSkin") as Object /* flash.display.Sprite */;
            ObjCreate.createBitmap(ImagesConst.ChatGuildMember_star, 6, 4, loc1);
            this.setStyle("overSkin", new Object /* flash.display.Bitmap */());
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            this._myData = arg1 as SCrossBossGuildInfo;
            return;
        }

        public /* override */ set listData(arg1: ListData)
        {
            super.listData = arg1;
            this.updateView();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            var loc1=GlobalStyle.textFormat1;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            var loc2=GlobalStyle.textFormat2;
            loc2.align = flash.text.TextFormatAlign.CENTER;
            this._txtIndex = ObjCreate.createGTextField("", 10, 6, 50, 20, this, loc1);
            this._serverName = ObjCreate.createGTextField("", 70, 6, 100, 20, this, loc2);
            this._txtName = ObjCreate.createGTextField("", 140, 6, 185, 20, this, loc1);
            this._txtCamp = ObjCreate.createGTextField("", 295, 6, 70, 20, this, loc1);
            this._txtScore = ObjCreate.createGTextField("", 350, 6, 108, 20, this, loc2);
            this._line = ObjCreate.createBg(9, 25, 426, 2, this, ImagesConst.SplitLine);
            return;
        }

        /* internal  */updateView(): void
        {
            if (this._myData == null) 
            {
                return;
            }
            var loc1="#ffffff";
            var loc2=listData.row + 1;
            var loc5=loc2;
            switch (loc5) 
            {
                case 1:
                {
                    loc1 = GlobalStyle.color9;
                    break;
                }
                case 2:
                {
                    loc1 = GlobalStyle.color8;
                    break;
                }
                case 3:
                {
                    loc1 = GlobalStyle.color4;
                    break;
                }
            }
            this._txtIndex.htmlText = HTMLUtil.addColor(String(loc2), loc1);
            this._serverName.text = EntityUtil.getProxyName(this._myData.entityId);
            this._txtName.text = this._myData.guildName;
            var loc3=GameDefConfig.instance.getECamp(this._myData.camp);
            var loc4=ColorConfig.instance.getCampColor(this._myData.camp).color;
            this._txtCamp.htmlText = HTMLUtil.addColor(loc3, loc4);
            this._txtScore.text = String(this._myData.score);
            return;
        }

        protected /* var */_myData: SCrossBossGuildInfo;

        protected /* var */_txtName: GTextFiled;

        protected /* var */_txtIndex: GTextFiled;

        protected /* var */_serverName: GTextFiled;

        protected /* var */_txtCamp: GTextFiled;

        protected /* var */_txtScore: GTextFiled;

        protected /* var */_line: ScaleBitmap;
    }
